﻿ <core:ViewBase  x:Class="DXTools.UI.Modules.MetadataBrowser.Views.EntitiesView"
    xmlns:core="clr-namespace:DXTools.UI.Core.View;assembly=DXTools.UI.Core"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:layout="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"
    xmlns:metadata="clr-namespace:DXTools.UI.Modules.MetadataBrowser" 
    xmlns:converters="clr-namespace:DXTools.UI.Core.Converters;assembly=DXTools.UI.Core"
    xmlns:MBConverters="clr-namespace:DXTools.UI.Modules.MetadataBrowser.Converters"            
                
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="800" Margin="5,5,15,5">
     
        <UserControl.Resources>
        <MBConverters:ObjectConverter x:Key="ConvertObject" />
        </UserControl.Resources>
        <toolkit:BusyIndicator IsBusy="{Binding IsBusy}">
            
            
        <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="33" ></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Background="DarkGray" VerticalAlignment="Stretch">
                <Border CornerRadius="5" Margin="2,3,1,2" Background="White" HorizontalAlignment="Left" BorderBrush="#C0CDDC" BorderThickness="0">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="200"/>
                            <ColumnDefinition Width="24" />

                        </Grid.ColumnDefinitions>

                        <TextBox Grid.Column="0" Margin="0"  Text="{Binding Path=SearchText, Mode=TwoWay}" 
                                metadata:EnterKeyDown.Command="{Binding SearchCommand}" 
                                metadata:EnterKeyDown.CommandArgument="{Binding Path=Text,RelativeSource={RelativeSource Self}}"
                            BorderThickness="0" HorizontalAlignment="Left" VerticalAlignment="Center" Name="uxSearchText"  Width="200" Height="20"/>
                        <Button  Grid.Column="1"  Margin="0"                    
                        Command="{Binding SearchCommand}" BorderThickness="0" ToolTipService.ToolTip="Search" >
                            <Button.Content>
                                <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Center" >
                                    <Image Source="../Images/search.png"   Width="21" Height="20" />
                                </StackPanel>
                            </Button.Content>
                        </Button>
                    </Grid>
                </Border>
            </StackPanel>

            <data:DataGrid Grid.Row="1" ItemsSource="{Binding FilteredEntityList}"  AutoGenerateColumns="False" HorizontalAlignment="Stretch"  Name="uxData" IsReadOnly="True" VerticalContentAlignment="Top">
            <!--
            <data:DataGrid.ColumnHeaderStyle>
                <Style x:Name="AngleHeader"  TargetType="primitives:DataGridColumnHeader" >
                    <Setter Property="FontSize" Value="12" />
                    <Setter Property="FontWeight" Value="Bold"  />
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="Padding" Value="2" />
                    <Setter Property="VerticalContentAlignment" Value="Bottom" />
                    <Setter Property="Height" Value="140" />
                    <Setter Property="ContentTemplate" >
                        <Setter.Value>
                            <DataTemplate >
                                <layout:LayoutTransformer>
                                    <layout:LayoutTransformer.LayoutTransform>
                                        <RotateTransform Angle="-35"/>
                                    </layout:LayoutTransformer.LayoutTransform>
                                    <TextBlock Text="{Binding}" TextWrapping="Wrap"   />
                                </layout:LayoutTransformer>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

            </data:DataGrid.ColumnHeaderStyle>
-->
            <data:DataGrid.Columns>

                <data:DataGridTemplateColumn  Header="Logical Name" CanUserSort="True" SortMemberPath="LogicalName" x:Name="LogicalName">

                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>

                                <HyperlinkButton Click="LoadEntity" Content="{Binding LogicalName, Converter={StaticResource ConvertObject}}"  FontFamily="Arial" FontSize="12"  VerticalAlignment="Center" Margin="4"   />
                        </DataTemplate>

                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>
                <data:DataGridTextColumn Header="Logical Name" Binding="{Binding LogicalName, Converter={StaticResource ConvertObject}}" Visibility="Collapsed" />

                <data:DataGridTextColumn Header="Schema Name" Binding="{Binding SchemaName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Display Name" Binding="{Binding DisplayName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Display Collection Name" Binding="{Binding DisplayCollectionName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Object Type Code" Binding="{Binding ObjectTypeCode}" />
                <data:DataGridTextColumn Header="Ownership Type" Binding="{Binding OwnershipType, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Description" Binding="{Binding Description, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Primary Id Attribute" Binding="{Binding PrimaryIdAttribute, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Primary Name Attribute" Binding="{Binding PrimaryNameAttribute, Converter={StaticResource ConvertObject}}" />

                <data:DataGridCheckBoxColumn Header="Is Custom Entity" Binding="{Binding IsCustomEntity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Customizable" Binding="{Binding IsCustomizable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Activity" Binding="{Binding IsActivity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Managed" Binding="{Binding IsManaged, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Audit Enabled" Binding="{Binding IsAuditEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Available Offline" Binding="{Binding IsAvailableOffline, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Child Entity" Binding="{Binding IsChildEntity, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Connections Enabled" Binding="{Binding IsConnectionsEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Document Management Enabled" Binding="{Binding IsDocumentManagementEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Duplicate Detection Enabled" Binding="{Binding IsDuplicateDetectionEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Enabled For Charts" Binding="{Binding IsEnabledForCharts, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Importable" Binding="{Binding IsImportable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Intersect" Binding="{Binding IsIntersect, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Mail Merge Enabled" Binding="{Binding IsMailMergeEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Mappable" Binding="{Binding IsMappable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Renameable" Binding="{Binding IsRenameable, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Reading Pane Enabled" Binding="{Binding IsReadingPaneEnabled, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Valid For Advanced Find" Binding="{Binding IsValidForAdvancedFind, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Valid For Queue" Binding="{Binding IsValidForQueue, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Is Visible In Mobile" Binding="{Binding IsVisibleInMobile, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be In Many To Many" Binding="{Binding CanBeInManyToMany, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be Primary Entity In Relationship" Binding="{Binding CanBePrimaryEntityInRelationship, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Be Related Entity In Relationship" Binding="{Binding CanBeRelatedEntityInRelationship, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Attributes" Binding="{Binding CanCreateAttributes, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Charts" Binding="{Binding CanCreateCharts, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Forms" Binding="{Binding CanCreateForms, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Create Views" Binding="{Binding CanCreateViews, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Modify Additional Settings" Binding="{Binding CanModifyAdditionalSettings, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Can Trigger Workflow" Binding="{Binding CanTriggerWorkflow, Converter={StaticResource ConvertObject}}" />
                <data:DataGridCheckBoxColumn Header="Auto Route To Owner Queue" Binding="{Binding AutoRouteToOwnerQueue, Converter={StaticResource ConvertObject}}" />

                <data:DataGridTextColumn Header="Recurrence Base Entity Logical Name" Binding="{Binding RecurrenceBaseEntityLogicalName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Large Name" Binding="{Binding Path=IconLargeName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Medium Name" Binding="{Binding Path=IconMediumName, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Icon Small Name" Binding="{Binding Path=IconSmallName, Converter={StaticResource ConvertObject}}" />

                <data:DataGridTextColumn Header="Activity Type Mask" Binding="{Binding ActivityTypeMask, Converter={StaticResource ConvertObject}}" />
                <data:DataGridTextColumn Header="Metadata Id" Binding="{Binding MetadataId, Converter={StaticResource ConvertObject}}" />

            </data:DataGrid.Columns>


        </data:DataGrid>



    </Grid>
</toolkit:BusyIndicator>
</core:ViewBase>
